{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 什么是决策树"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import matplotlib.pyplot as plt"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn import datasets\n",
    "\n",
    "iris = datasets.load_iris()\n",
    "X = iris.data[:,2:]\n",
    "y = iris.target"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAD8CAYAAACMwORRAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvNQv5yAAAGgFJREFUeJzt3X2QXXV9x/H3d282JoaHjGYhMQkGJeAoAoEdHoyjmVojDylJrRGY+hCHSsdKhYnaESdTI8YpHTpoKlQagQKVRkjAEAmWUtGqpaFuApLKkxjQBAJZQIKJQZLdb/+4N8nu3XNzf+ees/c83M9rJpO9Z3/nnO+FyXfPnvv5/Y65OyIiUi5dWRcgIiLpU3MXESkhNXcRkRJScxcRKSE1dxGRElJzFxEpITV3EZESUnMXESkhNXcRkRIak9WJJ02a5DNmzMjq9CIihbRhw4YX3L2n2bjMmvuMGTPo6+vL6vQiIoVkZr8OGafbMiIiJaTmLiJSQmruIiIlpOYuIlJCau4iIiWk5i4iUkJq7iIiJdQ0525m04GbgcnAILDC3ZfXjZkD3Ak8Vdt0h7tfnm6pIlJ06zavY/nG5Ty36zkmT5jMJSdfwjlvOSfR/kCiY5ZVyCSmvcBn3X2jmR0KbDCze939kbpxP3H3eemXKCJlsG7zOpbev5RXB14FYNuubSy9fylAUDOO2n/JT5dgZuwZ3NPSMcus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fu7v5jIpY2KCJ33+buG2tf/w54lJGLshWCV+2sveyu/SnWlcMQZjYNOAe4LutapMrMDgPeA1wP4O6vFb2x17wP+FWajR0K2NzLysxmUJ3h+0C2lbSudhvjIWA7cK+7F/a9UJ2R/TfAYNaFpMCB/zCzDWZ2UdbFJPAWoB/4l9rtsuvMrAzPvzwfWJn2QdXcc8DMDgFuBy5191eyrqdV7j7g7idRXVzuVDMr5G0zM5sHbHf3DVnXkpLZ7n4y1QfufLp2a7OIxgAnA99091nALuAL2ZaUTO3W0rnAqrSPreaesdr96duBW9z9jqzrSUPtV+UfAWdmXEqrZgPn1u5Vfwf4IzP7drYltc7dn639vR34LtUH8BTRVmDrkN8IV1Nt9kV2FrDR3Z9P+8Bq7hmqfQh5PfCou1+VdT1JmFmPmU2sfT0e+GPgsWyrao27X+bu09x9BtVfme9z949kXFZLzGxC7cN6arcw5gKFTJq5+3PAFjM7rrbpfUDhwgd1LmAUbslA9decQjGzlcAcYJKZbQW+5O7XZ1tVy2YDHwU21e5VA3zR3e/OsKZWTQFuqn3y3wXc5u6FjhCWxJHAd2tPvRwD/Ju7/3u2JSXy18AttdsZm4FPZFxPy8zs9cD7gb8cleMXLQopIiLN6baMiEgJqbmLiJSQmruISAmpuYuIlJCau4hICam5i4iUkJq7iEgJqbmLiJTQ/wMx8DMUmXaorgAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x10d41e6a0>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.scatter(X[y==0,0], X[y==0,1])\n",
    "plt.scatter(X[y==1,0], X[y==1,1])\n",
    "plt.scatter(X[y==2,0], X[y==2,1])\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "DecisionTreeClassifier(class_weight=None, criterion='entropy', max_depth=2,\n",
       "            max_features=None, max_leaf_nodes=None,\n",
       "            min_impurity_decrease=0.0, min_impurity_split=None,\n",
       "            min_samples_leaf=1, min_samples_split=2,\n",
       "            min_weight_fraction_leaf=0.0, presort=False, random_state=42,\n",
       "            splitter='best')"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from sklearn.tree import DecisionTreeClassifier\n",
    "\n",
    "dt_clf = DecisionTreeClassifier(max_depth=2, criterion=\"entropy\", random_state=42)\n",
    "dt_clf.fit(X, y)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "def plot_decision_boundary(model, axis):\n",
    "    \n",
    "    x0, x1 = np.meshgrid(\n",
    "        np.linspace(axis[0], axis[1], int((axis[1]-axis[0])*100)).reshape(-1, 1),\n",
    "        np.linspace(axis[2], axis[3], int((axis[3]-axis[2])*100)).reshape(-1, 1),\n",
    "    )\n",
    "    X_new = np.c_[x0.ravel(), x1.ravel()]\n",
    "\n",
    "    y_predict = model.predict(X_new)\n",
    "    zz = y_predict.reshape(x0.shape)\n",
    "\n",
    "    from matplotlib.colors import ListedColormap\n",
    "    custom_cmap = ListedColormap(['#EF9A9A','#FFF59D','#90CAF9'])\n",
    "    \n",
    "    plt.contourf(x0, x1, zz, cmap=custom_cmap)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAD8CAYAAACMwORRAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvNQv5yAAAHDpJREFUeJzt3X2QHPV95/H3dx+Q0LJiwRJIIJk1BYmNSZDCnoytKxcVOxwgyriIuZPP59guKkolxgd3qbo60BVPZ4ekrsqOyvjsUoALJD6IebCjBBFjl0l4cPGwkkUMiCvrsDk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dQXfSu5z98Nm1gs8A9zg7s9lXFpDzOw/A0PAQne/Kut6GmFmvwKG3L2QXwIys/uAp9397iCdt8DdD2RdV6OCZVv+BfiIu7+RRQ2lO3N396cocMbe3fe4+9bg9Siwnco3gHPPKw4Hm73BT6HOHsxsGbAGuDvrWjqNmS0EPk4lfYe7v1fExh74BPB/s2rsUMLmXiZmNgisBJ7PtpL4gksa24AR4EfuXpjaA38O/BcgvJh/UTjwhJltCZb7KJJzgbeA/xVcFrvbzPqyLiqhtcADWRag5p5TZnYK8Ahwo7sfyrqeuNx93N1XUPkm8yozK8ylMTO7Chhx9y1Z19KE1e7+W1RWcf1ycJmyKHqA3wK+7e4rgSPAf822pMYFl5M+BTyUZR1q7jkUXK9+BPiuuz+adT1JBP+c/kfg8oxLacRq4FPBdesHgd82s7/OtqTGuPvu4L8jwPeprOpaFLuAXVX/2nuYSrMvmiuAre6+N8si1NxzJrgpeQ+w3d2/nnU9jTCzxWY2ELw+Gfgk8Fq2VcXn7je5+zJ3H6Tyz+qfuPt/yLis2MysL7gJT3A54zKgMKkxd38T2Glmvx4MfQLIfZAgwmfJ+JIMxHwSU5GY2QPApcAiM9sF3Oru92RbVUNWA58Hfh5cuwa42d03Z1hTXEuB+4KkQBfwPXcvXJywwM4Evh88SqEH+N/u/g/ZltSwrwDfDS5tvA58KeN6GmJmC4DfAf4g81rKFoUUERFdlhERKSU1dxGRElJzFxEpITV3EZESUnMXESkhNXcRkRJScxcRKaH/D6v9Z7UVcMyCAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x10ec52b00>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plot_decision_boundary(dt_clf, axis=[0.5, 7.5, 0, 3])\n",
    "plt.scatter(X[y==0,0], X[y==0,1])\n",
    "plt.scatter(X[y==1,0], X[y==1,1])\n",
    "plt.scatter(X[y==2,0], X[y==2,1])\n",
    "plt.show()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
